extends "../cTDM_1_1/cTDM_1_1.gd"
func _info():
	pass

func _connect():
	._connect()
var baseId = ""

func _extInit():
	._extInit()
	lv = 4
	attCoe.atk *=1.5
	attCoe.maxHp *= 1.5
	addCdSkill("bf",15)
	addSkillTxt("冰爆：引爆敌方全体所有结霜，造成<结霜层数*37>点真伤[上限攻击5倍]，并使单位附近1格范围内的敌人附加1层<结霜>[不触发冰爆][cd:15秒]")

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "bf":
		var waitadd = []
		var chas = getAllChas(1)
		var dmglimt = att.atk*5
		for i in chas:
			var bf = i.hasBuff("b_jieShuang")
			if bf:
				var dmg = min(dmglimt,int(bf.life) * 37)
				hurtChara(i,dmg,Chara.HurtType.REAL,Chara.AtkType.SKILL)
				var chas2 = getrcha(i.cell,i.team)
				if !chas2:continue
				for j in chas2:
					waitadd.append(j)
				bf.isDel = true
		if waitadd.size():
			for i in waitadd:
				if i:
					i.addBuff(b_jieShuang.new(1))

func getrcha(cell,team):
	var chas = []
	var v = [Vector2(1,1),Vector2(1,0),Vector2(1,-1),Vector2(0,1),Vector2(0,-1),Vector2(-1,1),Vector2(-1,-1),Vector2(-1,0)]
	for i in v:
		if !sys.main.isMatin(i+cell):continue
		var cha = sys.main.matCha(i + cell)
		if cha && cha.team == team:
			chas.append(cha)
	return chas
